package com.mao.spring.cloud.api;

import com.mao.spring.cloud.entity.Employee;
import com.mao.spring.cloud.factory.MyFallBackFactory;
import com.mao.spring.cloud.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author: Administrator
 * @description:
 * @cteate 2021-06-15-20:25
 */
// @FeignClient表示当前接口和一个provider的抽象方法对应
// fallbackFactory指定consumer降级时调用的备用工厂类型
@FeignClient(value = "mao-provider",fallbackFactory = MyFallBackFactory.class)
public interface EmployeeRemoteService {

    // 远程调用的 接口方法
    // 需要和provider中的实现方法声明一致 && 注解一致
    @RequestMapping("/provider/get/employee/remote")
    Employee getEmployeeRemote();

    @RequestMapping("/provider/get/employee/list/remote")
    List<Employee> getEmpListRemote(@RequestParam("keyword") String keyword);

    @RequestMapping("/provider/get/employee/with/breaker")
    ResultEntity<Employee> getEmp(@RequestParam("signal") String signal);
}
